#include<stdio.h>
#include<iostream>
#include<string.h>
using namespace std;
int f(int d)
{
	if (!d || d == 1)return 1;
	else return f(d - 1) + 4 * (d - 1);
}
int main()
{
	int n, d;
	cin >> n;
	while (n--)
	{
		cin >> d;
		cout << f(d) << endl;
	}
	return 0;
}